package com.example.shop.controller;

import com.example.shop.entity.Order;
import com.example.shop.model.ApiResponse;
import com.example.shop.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * author: adnaan
 * create: 2023-11-07 15:56
 * Description:
 */

@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private OrderService orderService;

    @GetMapping("/page")
    public ApiResponse orderPage(@RequestParam Integer currentPage,
                                 @RequestParam Integer pageSize,
                                 @RequestParam String userId){
        return orderService.orderPage(currentPage,pageSize,userId);
    }

    @PostMapping("/orderAdd")
    public ApiResponse orderAdd(@RequestBody Order order){
        return orderService.orderAdd(order);
    }
}
